package com.cloudshadow.platform.assembly.security.model;

import java.io.Serializable;

/**
 * 授权用户信息匿名类.
 */
public class Principal<T> extends ClientModelBase<T> implements Serializable {

    /**
     * serialVersionUID.
     */
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID.
     */
    private String id;

    /**
     * 用户登陆名.
     */
    private String username;

    /**
     * 用户实体类.
     */
    private T user;


    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @return the user
     */
    public T getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(T user) {
        this.user = user;
    }

    @Override
    public String getClientIdStr() {
        return String.valueOf(id);
    }

    @Override
    public T getClient() {
        return user;
    }
}
